import java.io.*;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2020/10/19 16:31
 */
public class Test05 {
    public static void main(String[] args) throws IOException {
        String username = "liliya";
        String loginTime = System.currentTimeMillis()+"";
        File file = new File("user.txt");
        if (!file.exists()) file.createNewFile();
        try (
                FileInputStream in = new FileInputStream(file);
                FileOutputStream out = new FileOutputStream(file);
                ){
            String cookie = username+"-"+loginTime;
            out.write(cookie.getBytes("UTF-8"));

            BufferedReader br = new BufferedReader(new FileReader(file));
            String line = br.readLine();

            if ("liliya".equals(line.split("-")[0])&&(Long.valueOf(line.split("-")[1])+10000)>System.currentTimeMillis()){
                System.out.println("liliya登录成功");
            }

        }
    }
}
